package com.followmeandroid.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum ResultCode
{
    BADREQUEST(400),
    OK(200),
    NOTFOUND(404),
    CREATED(201),
    INTERNAL_ERROR(0),
    NOCONTENT(204);

    private static final Map<Integer,ResultCode> lookup
            = new HashMap<Integer,ResultCode>();

    static {
        for(ResultCode resultcode : EnumSet.allOf(ResultCode.class))
            lookup.put(resultcode.getStatus(), resultcode);
    }

    private int result;

    private ResultCode(int result){
        this.result = result;
    }

    public int getStatus(){return result;}

    public static ResultCode get(int result){
       return lookup.get(result);
    }
}
